home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / tools / czesc_2 / ixg06d / docs / ixclient_3.rexx < prev    next >
OS/2 REXX Batch file  |  1982-07-25  |  3KB  |  159 lines

  1. /* Sample arexx client program for iX-Guide   */
  2. /* How to make scrolling object which takes   */
  3. /* care of changing documents, screens ...    */
  4. /* NOTE: never write programs which perform   */
  5. /* some graphics operations for a long period */
  6. /* of time without using delay()              */
  7.  
  8. if show('p',"IXCL_3") then exit
  9.  
  10. if ~show('l', "rexxsupport.library") then
  11.     addlib('rexxsupport.library',0,-30,0)
  12.  
  13. OPTIONS RESULTS
  14.  
  15. txt.1 = '"    Scrolling text    "'
  16. txt.2 = '" -------------------- "'
  17. txt.3 = '"This is demo of Arexx "'
  18. txt.4 = '"  controled object.   "'
  19. txt.5 = '"  To stop scrolling   "'
  20. txt.6 = '"  press STOP button   "'
  21. txt.7 = '" and START button to  "'
  22. txt.8 = '"     start again      "'
  23. txt.9 = '" -------------------- "'
  24.  
  25. ADDRESS IXGUIDE
  26. AddClient
  27. portname = 'IXCL_3'
  28. call openport(portname)
  29. setport portname MISC
  30. AllocRaster 2
  31. rp=result
  32. refresh rp
  33. SetABPen rp 1 0
  34.  
  35. OpenFont 'times.font' 18; f1 = result
  36. OpenFont 'topaz.font' 8;  f2 = result
  37. SetDrMd rp 0
  38.  
  39. shutdown=0
  40. flag=0
  41. stopscroll=0
  42. contscroll=0
  43. ypos = 120
  44. linecnt = 1
  45.  
  46. do until shutdown
  47.  call waitpkt(portname)
  48.  msg = getpkt(portname)
  49.  
  50.  if msg ~= '0000 0000'x then do
  51.   class = getarg(msg)
  52.   
  53.   if class = 'MISC' then do
  54.    a1 = getarg(msg,1)
  55.    
  56.    if a1 = 'QUIT' then shutdown=1
  57.    
  58.    if a1 = 'LINKREQ' then do
  59.     a2 = getarg(msg,2)
  60.     if a2 = 'rx_start' then do
  61.      flag=1  /* we should start scrolling */    
  62.      stopscroll=0
  63.     end
  64.    end /*end if LINKREQ*/
  65.    
  66.    if (a1 = 'LINKOK') | (a1 = 'LINKFAILED') then
  67.     if contscroll then do
  68.      a2 = getarg(msg,2)
  69.      a3 = getarg(msg,3)
  70.      if (a2='iX-Guide.ixml') & (a3='arexx_demo') then do
  71.       flag=1
  72.       stopscroll=0
  73.       contscroll=0
  74.      end
  75.     end
  76.    
  77.    if (a1 = 'OLDSCREEN') | (a1 = 'NEWSCREEN') then
  78.     if contscroll then do
  79.       flag=1
  80.       stopscroll=0
  81.       contscroll=0
  82.     end
  83.  
  84.   end /*end if class==MISC*/
  85.   call reply(msg,0)
  86.  end /*end if msg*/
  87.  
  88. if flag=1 then do /* should we start scrolling? */
  89. do until stopscroll
  90.  call scroll()
  91.  call delay(1)
  92.  call checkinput()
  93. end /*end until stopscroll*/
  94. flag=0
  95. end /*end if flag==1*/
  96. end /*end until shutdown*/
  97.  
  98. /* clean up */
  99. CloseFont f1; CloseFont f2
  100. FreeRaster rp
  101. RemClient
  102. call closeport(portname)
  103. exit
  104.  
  105. checkinput:
  106.  cimsg = getpkt(portname)
  107.  do while cimsg ~= '0000 0000'x
  108.   ciclass = getarg(cimsg)
  109.   if ciclass = 'MISC' then do
  110.    cia1 = getarg(cimsg,1)
  111.    
  112.    if cia1 = 'QUIT' then do
  113.     stopscroll=1
  114.     shutdown=1
  115.    end
  116.    
  117.    if cia1 = 'LINKREQ' then do
  118.     stopscroll=1
  119.     cia2 = getarg(cimsg,2)
  120.     if cia2 ~= 'rx_stop' then contscroll=1
  121.     call reply(cimsg,0)
  122.     return 0
  123.    end
  124.    
  125.    if cia1 = 'ASKSCREEN' then do
  126.     stopscroll=1
  127.     contscroll=1
  128.     call reply(cimsg,0)
  129.     return 0
  130.    end
  131.  
  132.   end /*end if 'MISC'*/
  133.  call reply(cimsg,0)
  134.  cimsg = getpkt(portname)
  135.  end /*end do while cimsg*/
  136. return 0
  137.  
  138. scroll:
  139.  ypos = ypos - 1
  140.  if ypos<110 then do
  141.   ypos = 120
  142.   linecnt=linecnt+1
  143.   if linecnt>9 then linecnt=1
  144.  end
  145.  ScrollRaster rp 0 1 0 0 197 178
  146.  if linecnt=1 then SetABPen rp 2
  147.  else SetABPen rp 1
  148.  if linecnt=1 then do
  149.  SetFont rp f1
  150.  Move rp 30 ypos+2
  151.  Text rp txt.linecnt
  152.  end
  153.  else do
  154.  SetFont rp f2
  155.  Move rp 10 ypos
  156.  Text rp txt.linecnt
  157.  end
  158. return 0
  159.